********Figure D.1 - Indonesia********

*Load data
cd "$reploc/data/created_data"
use indo_full, clear

drop if ifls==.

clonevar ifls2 = ifls 
label define iflslab 4 "IFLS4" 5 "IFLS5", modify
label values ifls2  iflslab

sort pidlink ifls
drop if ifls==.
*keep if panel==1

*Do this analysis for full sample
sort pidlink ifls
foreach var of varlist rbuc_garefined rbuc grbrprovAvg_lam0co3 grbrprovSD_lam0co3 inflation{
gen `var'dif=`var'-`var'[_n-1] if ifls==5 & pidlink==pidlink[_n-1]
} 

gen eithrisk=0
replace eithrisk=1 if rbucdif!=. 

egen fullsample=total(eithrisk), by(pidlink)
keep if fullsample==1

cd "$reploc/results"
hist rbuc, percent by(ifls2, note(" ") graphregion(color(white))) discrete xlabel(1(1)5) fcolor(green) lcolor(ebg)
graph export FigureD1Indonesia.eps, replace
